﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace SaleManagement
{
    public partial class BaseUC : UserControl
    {
        public BaseUC()
        {
            InitializeComponent();
            
            InitGridData();

            this.Dock = DockStyle.Fill;
        }

        public DataGridView DataGridView
        {
            get { return this.dataGridView; }
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            OnAdd(sender, e);
        }

        private void btnEdit_Click(object sender, EventArgs e)
        {
            OnEdit(sender, e);
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            OnDelete(sender, e);
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            OnRefresh(sender, e);
        }

        private void btnPrePrint_Click(object sender, EventArgs e)
        {
            OnPreview(sender, e);
        }
        private void btnPrint_Click(object sender, EventArgs e)
        {
            OnPrint(sender, e);
        }
        public virtual void OnAdd(object sender, EventArgs e)
        {
        }
        public virtual void OnEdit(object sender, EventArgs e)
        {
        }
        public virtual void OnDelete(object sender, EventArgs e)
        {
        }
        public virtual void OnRefresh(object sender, EventArgs e)
        {
            onLoad();
        }
        public virtual void OnPrint(object sender, EventArgs e)
        {
        }
        public virtual void OnPreview(object sender, EventArgs e)
        {
        }
        public virtual void InitGridData()
        {
        }
        public virtual void onLoad()
        {

        }

        private void BaseUC_Load(object sender, EventArgs e)
        {
            onLoad();
        }       
        public virtual void OnGridDataCellClick(object sender, DataGridViewCellEventArgs e)
        {
        }

        private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            OnGridDataCellClick(sender, e);
        }

        private void dataGridView_UserAddedRow(object sender, DataGridViewRowEventArgs e)
        {
            onLoad();
        }





    }
}
